package com.hj.learn.demo2;

public class Lamda1{
    //3.静态内部类
   static class Like2 implements ILike{
        @Override
        public void lamda() {
            System.out.println("i like lammda2");
        }
    }


    public static void main(String[] args) {
        ILike Like = new Like();
        Like.lamda();

        Like  = new Like2();
        Like.lamda();


        //局部内部类
        class Like3 implements ILike{
            @Override
            public void lamda() {
                System.out.println("i like lammda3");
            }
        }
        Like  = new Like3();
        Like.lamda();

        //Lamda表达式
        Like =()->{
            System.out.println("i like lammda5");
        };
        Like.lamda();
        //匿名内部类
        Like = new ILike() {
            @Override
            public void lamda() {
                System.out.println("i like lammda4");
            }
        };
        Like.lamda();

    }


}
//1.定义一个函数式接口
interface ILike{
    void lamda();
}
//2.实现类
class Like implements ILike{
    @Override
    public void lamda() {
        System.out.println("i like lammda");
    }
}